package com.cn.arcgisdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.esri.arcgisruntime.ArcGISRuntimeEnvironment;
import com.esri.arcgisruntime.layers.ArcGISTiledLayer;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.Viewpoint;
import com.esri.arcgisruntime.mapping.view.MapView;

public class LoadRemoteImageServer extends AppCompatActivity {

    private MapView mMapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_load_remote_image_server);

        mMapView = (MapView)findViewById(R.id.mapView);
        mMapView.setAttributionTextVisible(false);
        ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer("http://172.21.0.208:6080/arcgis/rest/services/DGHY/WeiPian2018/MapServer");
        Basemap basemap = new Basemap(tiledLayer);
        ArcGISMap map = new ArcGISMap(basemap);
        mMapView.setMap(map);
        mMapView.setViewpoint(new Viewpoint(26.158865, 107.315800, 1000000));

    }


    @Override
    protected void onPause() {
        mMapView.pause();
        super.onPause();
    }

    @Override
    protected void onResume() {
        mMapView.resume();
        super.onResume();
    }

    @Override
    protected void onDestroy() {
        mMapView.dispose();
        super.onDestroy();
    }


    //返回主页
    public void returnMainActivty(View view){
        Intent intent = new Intent(this, MainActivity.class);
        startActivity(intent);
    }
}